<?php
if($_GET[job]=='js'){
	require_once(dirname(__FILE__)."/php168/ad_cache.php");
	$show=str_replace("\n","",$_AD_label[$_GET[ad_id]]);
	$show=str_replace("\r","",$show);
	$show=str_replace("'","\'",$show);
	echo "document.write('$show');";
	exit;
}
require(dirname(__FILE__)."/"."global.php");
if($job=="jump")
{
	$rs=$db->get_one("SELECT * FROM {$pre}ad WHERE id='$id'");
	$acodedb=unserialize($rs[adcode]);
	if($acodedb){
		$db->query("UPDATE {$pre}ad SET hits=hits+1 WHERE id='$id'");
		if($u_id){
			$db->query("UPDATE {$pre}ad_user SET u_hits=u_hits+1 WHERE u_id='$u_id'");
		}
		if($acodedb[linkurl]&&!$u_id){
			header("location:$acodedb[linkurl]");
		}else{
			$url=base64_decode($url);
			header("location:$url");
		}
		
		exit;
	}
}
elseif($job=='sell')
{
	$query = $db->query("SELECT * FROM `{$pre}sellad_user` WHERE id='$id' AND endtime>'$timestamp' AND yz=1 ORDER BY money DESC");
	while($rs = $db->fetch_array($query))
	{
		echo "document.write('<div class=\"ad_js\"><A HREF=\"$rs[adlink]\" target=_blank>$rs[adword]</A></div>');\r\n";
	}
}
?>